/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gui;

import controlador.ControladorCompra;
import controlador.ControladorTransacoes;
import java.sql.Date;
import java.text.DecimalFormat;
import java.util.ArrayList;
import javax.swing.JOptionPane;
import utils.Compra;
import utils.Transacoes;

/**
 *
 * @author Igor
 */
public class PainelEdicaoTransacoes extends javax.swing.JFrame {

    /**
     * Creates new form PainelEdicaoTransacoes
     */
    private Transacoes transacaoEscolhida;
    private int idSelecionado;
    ControladorTransacoes controladorTransacoes = new ControladorTransacoes();
    ControladorCompra controladorCompras = new ControladorCompra();
    DecimalFormat df = new DecimalFormat("#.##");
    private int[] anos = {2016, 2015, 2014, 2013, 2012, 2011, 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003, 2002, 2001, 2000};

    public PainelEdicaoTransacoes() {
        initComponents();
    }

    public PainelEdicaoTransacoes(Transacoes transacaoEscolhida, int idSelecionado) {
        initComponents();
        this.transacaoEscolhida = transacaoEscolhida;
        this.novaQuantidadeTransacoes.setText(String.valueOf(transacaoEscolhida.getQuantidadeVendidade()));
        this.novoCPFCNPJTransacoes.setText(transacaoEscolhida.getCpf_cnpjCliente());
        this.novoDescontoTransacoes.setText(String.valueOf(transacaoEscolhida.getDescontoDado()));
        this.novoID.setText(String.valueOf(transacaoEscolhida.getIdDaTransacao()));
        this.novoNomeCliente.setText(transacaoEscolhida.getNomeDoCliente());
        this.novoNomeProdutoTransacao.setText(transacaoEscolhida.getNomeDoProduto());
        this.novoPrecoUnidadeTransacoes.setText(String.valueOf(transacaoEscolhida.getPrecoPorUnidade()));
        this.novoValorTotalTransacoes.setText(String.valueOf(transacaoEscolhida.getValorTotalDaTransacao()));
        this.novoCodigoProdutoTransacoes.setText(transacaoEscolhida.getCodigoDoProduto());

        Date data = transacaoEscolhida.getData();
        int year = data.getYear() + 1900;
        int day = data.getDate();
        int month = data.getMonth();


        this.comboNovoAno.setSelectedIndex(2016 - year);
        this.comboNovoMes.setSelectedIndex(month);
        this.comboNovoDia.setSelectedIndex(day - 1);


    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        novoID = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        novoNomeCliente = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        novoCPFCNPJTransacoes = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        novoNomeProdutoTransacao = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        novoCodigoProdutoTransacoes = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        novaQuantidadeTransacoes = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        novoPrecoUnidadeTransacoes = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        novoValorTotalTransacoes = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        novoDescontoTransacoes = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        comboNovoDia = new javax.swing.JComboBox();
        comboNovoMes = new javax.swing.JComboBox();
        comboNovoAno = new javax.swing.JComboBox();
        confirmarAlteracaoTransacao = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        removerTransacao = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jLabel1.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
        jLabel1.setText("Painel de Edição de Transações");

        jLabel2.setText("Coloque o novo ID:");

        jLabel3.setText("Nome do cliente:");

        jLabel4.setText("CPF_CNPJ do cliente:");

        jLabel5.setText("Nome do produto:");

        jLabel6.setText("Código do produto:");

        jLabel7.setText("Quantidade de produtos:");

        jLabel8.setText("Preço por unidade:");

        jLabel9.setText("Valor total da transação:");

        jLabel10.setText("Desconto:");

        jLabel11.setText("Data:");

        comboNovoDia.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31" }));

        comboNovoMes.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Jan", "Fev", "Mar", "Abr", "Maio", "Jun", "Jul", "Ago", "Set", "Out", "Nov", "Dez" }));

        comboNovoAno.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "2016", "2015", "2014", "2013", "2012", "2011", "2010", "2009", "2008", "2007", "2006", "2005", "2004", "2003", "2002", "2001", "2000" }));

        confirmarAlteracaoTransacao.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/select.png"))); // NOI18N
        confirmarAlteracaoTransacao.setText("Confirmar");
        confirmarAlteracaoTransacao.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                confirmarAlteracaoTransacaoActionPerformed(evt);
            }
        });

        jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/cancel.png"))); // NOI18N
        jButton2.setText("Cancelar");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        removerTransacao.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/remove.png"))); // NOI18N
        removerTransacao.setText("Remover");
        removerTransacao.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                removerTransacaoActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(31, 31, 31)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addComponent(jLabel5)
                        .addComponent(jLabel4)
                        .addComponent(jLabel3)
                        .addComponent(jLabel2)
                        .addComponent(novoNomeCliente)
                        .addComponent(novoID, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(novoCPFCNPJTransacoes, javax.swing.GroupLayout.PREFERRED_SIZE, 216, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(novoNomeProdutoTransacao, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE))
                    .addComponent(jLabel6)
                    .addComponent(novoCodigoProdutoTransacoes, javax.swing.GroupLayout.PREFERRED_SIZE, 212, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addComponent(novaQuantidadeTransacoes, javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jLabel7, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel8)
                            .addComponent(novoPrecoUnidadeTransacoes, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel10)
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addComponent(novoDescontoTransacoes, javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(novoValorTotalTransacoes, javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jLabel9, javax.swing.GroupLayout.Alignment.LEADING))
                            .addComponent(jLabel11)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addComponent(comboNovoDia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(comboNovoMes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(comboNovoAno, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(241, 241, 241))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addComponent(confirmarAlteracaoTransacao)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButton2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(removerTransacao)
                        .addGap(131, 131, 131))))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(23, 23, 23)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(jLabel8))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(novoID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(novoPrecoUnidadeTransacoes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(jLabel9))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(novoNomeCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(novoValorTotalTransacoes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(jLabel10))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(novoCPFCNPJTransacoes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(novoDescontoTransacoes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(jLabel11))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(novoNomeProdutoTransacao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(comboNovoDia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(comboNovoMes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(comboNovoAno, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(jLabel6)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(novoCodigoProdutoTransacoes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(65, 65, 65)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(confirmarAlteracaoTransacao)
                            .addComponent(jButton2)
                            .addComponent(removerTransacao)))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(jLabel7)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(novaQuantidadeTransacoes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(40, Short.MAX_VALUE))
        );

        jPanel2.setBackground(new java.awt.Color(0, 0, 102));

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 9, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(layout.createSequentialGroup()
                .addGap(37, 37, 37)
                .addComponent(jLabel1)
                .addContainerGap())
            .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(50, 50, 50)
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        this.dispose();
    }//GEN-LAST:event_jButton2ActionPerformed

    private void confirmarAlteracaoTransacaoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_confirmarAlteracaoTransacaoActionPerformed
        if (!novoID.getText().equals("") && !novoNomeCliente.equals("") && !novoCPFCNPJTransacoes.equals("") && !novoNomeProdutoTransacao.equals("") && !novoCodigoProdutoTransacoes.equals("") && !novaQuantidadeTransacoes.equals("") && !novoValorTotalTransacoes.equals("") && !novoDescontoTransacoes.equals("")) {
            Date novaData = new Date(anos[comboNovoAno.getSelectedIndex()] - 1900, comboNovoMes.getSelectedIndex(), comboNovoDia.getSelectedIndex() + 1);
            controladorTransacoes.atualizaTransacoes(novoID.getText(), novoNomeCliente.getText(), novoCPFCNPJTransacoes.getText(), novoNomeProdutoTransacao.getText(), novoCodigoProdutoTransacoes.getText(), novaQuantidadeTransacoes.getText(), novoPrecoUnidadeTransacoes.getText(), novoValorTotalTransacoes.getText(), novoDescontoTransacoes.getText(), novaData, novoID.getText());

            ArrayList<Compra> compras = controladorCompras.buscaCompraPorIDExato(transacaoEscolhida.getIdDaCompra());
            Compra compraAtual = compras.get(0);
            ArrayList<Transacoes> transacoes = controladorTransacoes.buscaTransacoesPorIDDaCompra(compraAtual.getId());
            double valorFinal = 0;
            double descontoFinal = 0;

            for (int i = 0; i < transacoes.size(); i++) {
                valorFinal = Double.parseDouble(df.format(valorFinal + transacoes.get(i).getValorTotalDaTransacao() - transacoes.get(i).getDescontoDado()).replace(",", "."));
                descontoFinal = Double.parseDouble(df.format(descontoFinal + transacoes.get(i).getDescontoDado()).replace(",", "."));
                controladorTransacoes.atualizaDatasTransacoes(transacoes.get(i).getIdDaTransacao(), novaData);
                controladorTransacoes.atualizaCliente(transacoes.get(i).getIdDaTransacao(), novoNomeCliente.getText(), novoCPFCNPJTransacoes.getText());
            }

            controladorCompras.atualizaCompra(compraAtual.getId(), valorFinal, descontoFinal, transacoes.get(0).getData(), novoNomeCliente.getText(), novoCPFCNPJTransacoes.getText());

            JOptionPane.showMessageDialog(this, "Transação atualizada com sucesso", "Warning", JOptionPane.WARNING_MESSAGE);
            this.dispose();
        } else {
            JOptionPane.showMessageDialog(this, "Os campos precisam ser corretamente preenchidos", null, JOptionPane.OK_OPTION);
        }
    }//GEN-LAST:event_confirmarAlteracaoTransacaoActionPerformed

    private void removerTransacaoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removerTransacaoActionPerformed
        if (transacaoEscolhida != null) {
            controladorTransacoes.deletaTransacaoPorId(transacaoEscolhida.getIdDaTransacao());
            ArrayList<Compra> compras = controladorCompras.buscaCompraPorIDExato(transacaoEscolhida.getIdDaCompra());
            Compra compraAtual = compras.get(0);
            ArrayList<Transacoes> transacoes = controladorTransacoes.buscaTransacoesPorIDDaCompra(compraAtual.getId());
            double valorFinal = 0;
            double descontoFinal = 0;

            for (int i = 0; i < transacoes.size(); i++) {
                valorFinal = Double.parseDouble(df.format(valorFinal + transacoes.get(i).getValorTotalDaTransacao() - transacoes.get(i).getDescontoDado()).replace(",", "."));
                descontoFinal = Double.parseDouble(df.format(descontoFinal + transacoes.get(i).getDescontoDado()).replace(",", "."));
            }

            controladorCompras.atualizaCompra(compraAtual.getId(), valorFinal, descontoFinal, transacoes.get(0).getData(), novoNomeCliente.getText(), novoCPFCNPJTransacoes.getText());


            JOptionPane.showMessageDialog(this, "Transação removida com sucesso", "Warning", JOptionPane.WARNING_MESSAGE);
        } else {
            JOptionPane.showMessageDialog(this, "Essa transação não pode ser removida", null, JOptionPane.OK_OPTION);
        }

        this.dispose();
    }//GEN-LAST:event_removerTransacaoActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(PainelEdicaoTransacoes.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(PainelEdicaoTransacoes.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(PainelEdicaoTransacoes.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(PainelEdicaoTransacoes.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new PainelEdicaoTransacoes().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JComboBox comboNovoAno;
    private javax.swing.JComboBox comboNovoDia;
    private javax.swing.JComboBox comboNovoMes;
    private javax.swing.JButton confirmarAlteracaoTransacao;
    private javax.swing.JButton jButton2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JTextField novaQuantidadeTransacoes;
    private javax.swing.JTextField novoCPFCNPJTransacoes;
    private javax.swing.JTextField novoCodigoProdutoTransacoes;
    private javax.swing.JTextField novoDescontoTransacoes;
    private javax.swing.JTextField novoID;
    private javax.swing.JTextField novoNomeCliente;
    private javax.swing.JTextField novoNomeProdutoTransacao;
    private javax.swing.JTextField novoPrecoUnidadeTransacoes;
    private javax.swing.JTextField novoValorTotalTransacoes;
    private javax.swing.JButton removerTransacao;
    // End of variables declaration//GEN-END:variables
}
